package online.shenme.day06;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Date;

public class DataTest {
    public static void main(String[] args) {
        Date date=new Date();
        String time="2021-07-07 00:00:00";
        LocalDateTime now = LocalDateTime.of(2021, 7, 7, 0, 0, 0);
        date.setTime(0L);
        System.out.println(date.getTime());
        System.out.println(date);
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date));
        DateTimeFormatter pattern=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime parse = LocalDateTime.parse(time, pattern);
        System.out.println(parse.plusDays(300+100).format(pattern));
        System.out.println(parse.plusYears(-1*50).format(pattern));
    }
}
